package com.chinacoal.microservice.api;

import javax.validation.Valid;

import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import com.chinacoal.microservice.api.fallback.ForeignSystemTaskClientFallback;
import com.chinacoal.microservice.api.model.ApproveTaskParam;
import com.chinacoal.microservice.api.model.ForeignTaskParam;
import com.chinacoal.microservice.api.model.resource.BusinessData;
import com.chinacoal.microservice.util.result.Result;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * @Description: 待办中心待办审批处理
 * @author linp
 * @date 2020年4月21日 下午3:52:08
 * @version V1.0
 */
@Api(tags = {"统一待办管理接口"})
@FeignClient(name = "ccms-union-task", configuration = FeignAutoConfiguration.class, fallback = ForeignSystemTaskClientFallback.class)
public interface ForeignSystemTaskClient {

	/**
	 * @Description: 统一待办详情获取接口
	 * @author linp
	 * @date 2020年4月21日 下午3:52:32
	 */
	 @ApiOperation(value = "统一待办详情获取接口")
	@PostMapping("/uniontask/foreign/task/detail")
    public Result<BusinessData> getTaskDetail(@Valid @RequestBody ForeignTaskParam foreignTaskParam) ;
	
	/**
	 * @Description: 统一待办审批处理接口
	 * @author linp
	 * @date 2020年5月9日 下午5:02:40
	 */
	 @ApiOperation(value = "统一待办审批处理接口")
    @PostMapping("/uniontask/foreign/task/approve")
    public Result<Object> approveTask(@Valid @RequestBody ApproveTaskParam approveTaskParam) ;
	
	/**
	 * @Description: 附件下载接口
	 * @author linp
	 * @date 2020年5月9日 下午5:02:46
	 */
    @ApiOperation(value = "待办附件下载接口")
    @PostMapping("/uniontask/foreign/task/attach")
    public Result<Object> downloadAttach(@Valid @RequestBody ForeignTaskParam foreignTaskParam) ;


	@ApiOperation(value = "待办附件下载接口")
	@GetMapping("/uniontask/foreign/task/attach")
	public ResponseEntity<byte[]> downloadAttach(@RequestParam("sysCode")String sysCode,
												 @RequestParam("fileName")String fileName,
												 @RequestParam("filePath")String filePath,
												 @RequestParam("sysTaskId")String sysTaskId) ;
	
    /**
     * @Description: 卡片消息集成待办的审批处理
     * @author linp
     * @date 2020年5月9日 下午5:02:53
     */
    @ApiOperation(value = "卡片消息集成待办的审批处理")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType="query", name = "sysCode", value = "系统编码", required = true, dataType = "String"),
        @ApiImplicitParam(paramType="query", name = "businessId", value = "业务主键", required = true, dataType = "String"),
        @ApiImplicitParam(paramType="query", name = "bizCode", value = "业务编码", required = true, dataType = "String"),
        @ApiImplicitParam(paramType="query", name = "taskId", value = "待办id", required = true, dataType = "String"),
        @ApiImplicitParam(paramType="query", name = "instanceId", value = "实例id", required = true, dataType = "String"),
        @ApiImplicitParam(paramType="query", name = "approvalOpinion", value = "审批意见", required = true, dataType = "String"),
        @ApiImplicitParam(paramType="query", name = "opcode", value = "操作码", required = true, dataType = "String"),
        @ApiImplicitParam(paramType="query", name = "userCode", value = "用户编码", required = true, dataType = "String")
    })
    @GetMapping("/uniontask/foreign/task/approve/card")
    public Result<Object> approveCard(@RequestParam(value = "sysCode",required = false) String sysCode,
    								  @RequestParam(value = "businessId",required = false) String businessId,
    								  @RequestParam(value = "bizCode",required = false) String bizCode,
    								  @RequestParam(value = "taskId",required = false) String taskId,
    								  @RequestParam(value = "instanceId",required = false) String instanceId,
    								  @RequestParam(value = "approvalOpinion",required = false) String approvalOpinion,
    								  @RequestParam(value = "opcode",required = false) String opcode,
    								  @RequestParam(value = "userCode",required = false) String userCode);
}
